package com.lc.rabbit.controller;

import com.lc.rabbit.service.RabbitMqService;
import com.study.common.res.ApiResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @description: some desc
 * @author: LChuang
 * @date: 2023/10/24 9:32
 */
@RestController
@RequestMapping("/mq/rabbit")
public class RabbitMqController {

    @Resource
    private RabbitMqService rabbitMqService;

    @PostMapping("/sendMsg")
    public ApiResult sendMsg(@RequestParam(name = "msg") String msg) {
        return ApiResult.success(rabbitMqService.sendMsg(msg));
    }

    @PostMapping("/publishMsg")
    public ApiResult publishMsg(@RequestParam(name = "msg") String msg) {
        return ApiResult.success(rabbitMqService.publishMsg(msg));
    }

    @PostMapping("/delay1SendMsg")
    public ApiResult delay1SendMsg(@RequestParam(name = "msg") String msg) {
        return ApiResult.success(rabbitMqService.delayed1Msg(msg));
    }

    @PostMapping("/delay2SendMsg")
    public ApiResult delay2SendMsg(@RequestParam(name = "msg") String msg) {
        return ApiResult.success(rabbitMqService.delayed2Msg(msg));
    }

    @PostMapping("/wildcardMsg")
    public ApiResult wildcardMsg(@RequestParam(name = "msg") String msg) {
        return ApiResult.success(rabbitMqService.wildcardMsg(msg));
    }

}
